package com.eastfair.venuebooking.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 展会负责人
 * </p>
 *
 * @author linan
 * @date 2022-06-23
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ResponsibilityerRoleEnum", description = "负责人角色 #{MAIN_IN_CHARGE:主要负责人;ASSISTING_STAFF:协助人员-枚举")
public enum ResponsibilityerRoleEnum implements BaseEnum {

    /**
     * MAIN_IN_CHARGE="主要负责人"
     */
    MAIN_IN_CHARGE("主要负责人"),
    /**
     * ASSISTING_STAFF="协助人员"
     */
    ASSISTING_STAFF("协助人员"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ResponsibilityerRoleEnum match(String val, ResponsibilityerRoleEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ResponsibilityerRoleEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ResponsibilityerRoleEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "MAIN_IN_CHARGE,ASSISTING_STAFF", example = "MAIN_IN_CHARGE")
    public String getCode() {
        return this.name();
    }

}
